#include <bits/stdc++.h>
#define pb push_back
// #define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
// #define len(x) x.size()
#define min3(a,b,c) min(a, min(b,c))
#define max3(a,b,c) max(a, max(b,c))
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=n-1,i>=b;i--)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvii;
typedef vector<string> vs;
int len(int x){
return (int)(log10(x)+(int)1);
}
int trail(int x){
int n1=1, n2=0;
while(x%(n1*=10)==0){
n2++;
}
return n2;
}
int comp(int i, int j){
return trail(i)<trail(j);
}
int32_t main() {
/* #ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL) ; cout.tie(NULL) ;*/
int t;cin>>t;
while(t--){
int n,m; cin>>n>>m;
vector<int> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a.begin(),a.end(),comp);
int ans=0;
for(int i=n-1;i>=0;i--){
ans+=len(a[i]);
if(i%2==(n-1)%2){
ans-=trail(a[i]);
}
}
if(ans<=m)cout<<"Anna"<<endl;
else cout<<"Sasha"<<endl;
}
}
1428B - Belted Rooms | 519B - A and B and Compilation Errors |
1152B - Neko Performs Cat Furrier Transform | 1411A - In-game Chat |
119A - Epic Game | 703A - Mishka and Game |
1504C - Balance the Bits | 988A - Diverse Team |
1312B - Bogosort | 1616B - Mirror in the String |
1660C - Get an Even String | 489B - BerSU Ball |
977C - Less or Equal | 1505C - Fibonacci Words |
1660A - Vasya and Coins | 1660E - Matrix and Shifts |
1293B - JOE is on TV | 1584A - Mathematical Addition |
1660B - Vlad and Candies | 1472C - Long Jumps |
1293D - Aroma's Search | 918A - Eleven |
1237A - Balanced Rating Changes | 1616A - Integer Diversity |
1627B - Not Sitting | 1663C - Pōja Verdon |
1497A - Meximization | 1633B - Minority |
688B - Lovely Palindromes | 66B - Petya and Countryside |